package cn.com.ldns.opentetris.shape;

import cn.com.ldns.opentetris.common.BoxType;

public class ShapeFactory {
	
	private static ShapeFactory instance;
	private ShapeFactory() {}
	
	public static ShapeFactory getInstance() {
		if (instance == null) {
			instance = new ShapeFactory();
		}
		return instance;
	}
	
	// 长方体
	public Cube createCube() {
		return new Cube();
	}
	
	// 长方形
	public Square createSquare() {
		return new Square();
	}
	
	public BaseBox createBox(BoxType boxType){
		switch (boxType) {
			case SHAPE_L:
				return new BoxL();
			case SHAPE_I:
				return new BoxI();
			case SHAPE_O:
				return new BoxO();
			case SHAPE_S:
				return new BoxS();
			case SHAPE_Z:
				return new BoxZ();
			case SHAPE_T:
				return new BoxT();
			case SHAPE_J:
				return new BoxJ();
		default:
			return null;
		}
	}
}
